Semiconductor storage device

ABSTRACT

A semiconductor storage device comprises a flash memory and manages the sectors in the unit of groups each consisting of n sectors. A logical sector number is converted to a logical group number and an offset address, and a conversion table is provided to convert a physical group number to a logical group number. A logical sector number is divided with n to get a quotient and a remainder which are set as a logical number and as an offset address. An access controller determines a physical group number corresponding to the logical group number with reference to the address conversion table, and it accesses a sector in correspondence to the offset address in the physical group number. Further, a group management information for each group is stored in a memory, and when a sector of a logical sector number is accessed, a physical group number of a group storing the data of the sector is traced by referring the conversion table and the group management information.

BACKGROUND OF THE INVENTION

[0001] 1. Field of the Invention

[0002] The present invention relates to a semiconductor storage device including a nonvolatile memory such as a flash memory.

[0003] 2. Description of the Prior Art

[0004] A hard disk drive is one of a large capacity storage device. It it has advantages of compactness and high cost performance, and it is used for a personal computer and a palm top (small and portable) personal computer. As a small personal computer becomes popular, a hard disk drive mounted in the small personal computer have been used often outdoors. When a personal computer is used in outdoors, it is required to operate for a long time with a battery and to have high endurance. However, because a hard disk is driven with a motor and affected by vibrations, it is not pertinent for a portable personal computer.

[0005] Then, a semiconductor storage device compatible with a hard disk drive has attracted attention for a portable personal computer. A semiconductor storage device comprises a nonvolatile memory such as a flash memory. Though it is inferior on cost performance to a hard disk drive, it is not affected by mechanical shocks, and it consumes a low electric power because no motor is needed.

[0006] A flash memory has following features in contrast to a hard disk drive which can overwrite data in the same sector. Data in a sector to be accessed have to be erased before the data are written, and data cannot be overwritten. Though read and write can be performed in the unit of a sector (512 bytes), erase can only be performed in the unit of a relatively large size such as 64 kbytes. Further, an upper limit of the erase times for a sector are smaller than a hard disk drive.

[0007] Then, a semiconductor storage device cannot be dealt with on erase in quite the same way as a hard disk drive. If a data is already written to a sector of a sector number designated by a host, a sector not used is searched, and the data is written to the sector. Thus, the data is written to a sector of a sector number not designated by the host. An address conversion table is provided in the semiconductor storage device to convert a sector number designated by a host (hereinafter referred to as a logical sector number) to a sector number to be written actually (hereinafter referred to as a physical sector number). When a data read is requested by a host, a physical sector number is determined in correspondence to the logical sector number by referring to the address conversion table, and a data is read from the physical sector determined as described above.

[0008] For a semiconductor storage device of 40 megabytes, two random access memory chips of 1 megabits or one random access memory chip of 4 megabits is needed. As a storage capacity of a flash memory increases, a storage size of an address conversion table also increases. Then, a cost of the semiconductor storage device increases, and a freedom of designing the device is limited by an increase in size of the random access memory.

SUMMARY OF THE INVENTION

[0009] An object of the present invention is to provide a semiconductor storage device which controls a large capacity of a flash memory by using a small capacity of an address conversion table.

[0010] In a semiconductor storage device using a flash memory, a plurality of sectors is managed in the unit of a group consisting of n sectors. A logical sector number is converted to a logical group number and an offset address by dividing the logical sector number with a natural number n and by setting a quotient of division as the logical group number and a remainder of division as the offset address. A conversion table stored in a random access memory for converting a logical group number to a physical group number. When the flash memory is accessed, a physical group number corresponding to the logical group number is determined with reference to the conversion table and a sector in the flash memory is calculated in correspondence to a sum of the offset address and a product of the physical group number and the natural number n.

[0011] Further, a management means is provided for storing information for managing each group of n sectors of the same physical group number. When a data for a logical group number and an offset address is written to a sector in the group of the physical group number in correspondence to the logical group number, if any data has already been written to one of the sectors in a group, another group not used is searched, the data is written to a sector in correspondence to the offset address in the another group. Then, the physical group number in correspondence to the logical group number is updated in the conversion table as a physical group number of the another group, and an address of the sector in the management means is also updated as the physical group number in correspondence to the logical group number before the conversion table is updated. On the other hand, when a sector of a logical sector number is read, a physical group number in correspondence to the logical group number is obtained by referring to the conversion table. If the group of the physical group number is used, the group is accessed. However, if another physical group number is stored in the management means in correspondence to the logical group number before the conversion table is updated, a status of the another physical group number is checked. This processing is continued with reference to the management means until a physical group number of a group which stores the data of a sector of the logical sector number is found. Preferably, if a number of checks for finding a physical group number of a group which stores the data of a sector of the logical sector number exceeds a predetermined number, latest data are written to a group not used, and the physical group number in correspondence to the logical address number is updated as a number of the group not used in the conversion table.

[0012] An advantage of the present invention is that a capacity of the address conversion table in a semiconductor storage memory can be decreased.

BRIEF DESCRIPTION OF THE DRAWINGS

[0013] These and other objects and features of the present invention will become clear from the following description taken in conjunction with the preferred embodiments thereof with reference to the accompanying drawings, and in which:

[0014]FIG. 1 is a block diagram of a semiconductor storage device of an embodiment of the invention;

[0015]FIG. 2 is a diagram of an erase block in a flash memory;

[0016]FIG. 3 is a diagram of a situation in an erase block when new data are written to sectors 0, 1 and 2;

[0017]FIG. 4 is a diagram of an address conversion table;

[0018]FIG. 5 is another diagram of an erase block in a flash memory;

[0019]FIG. 6 is another diagram of the address conversion table;

[0020]FIGS. 7A and 7B are flowcharts of data write;

[0021]FIGS. 8A, 8B, 8C, 8D, 8E and 8F are diagrams of group management data in each group in relation to data read;

[0022]FIGS. 9A, 9B, 9C, 9D, 9E and 9F are diagrams of group management data in each group for illustrating abbreviated linkage; and

[0023]FIG. 10 is a flowchart of data read.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0024] Referring now to the drawings, wherein like reference characters designate like or corresponding parts throughout the views, FIG. 1 shows a semiconductor storage device of an embodiment of the invention. A semiconductor storage device 11 is connected to a host 10 such as a personal computer. An interface 12 is provided for sending and receiving data to and from the host 10. A flash memory controller 14 controls data write to and data read from a flash memory 15. A buffer random access memory 17 stores temporarily data read from or written to the flash memory 15. An address conversion table 16 is stored in a random access memory. A central processing unit (CPU) 13 controls the operation of the entire semiconductor storage device 11.

[0025] The semiconductor storage device 11 manages four sectors as one group. A physical group number (PGN) is assigned to each group, and offset addresses (OA) of 0, 1, 2 and 3 are assigned to the four sectors in a group. A logical sector number LSN received from the host 10 is divided with 4, and the quotient of the division is set as a logical group number (LGN) and the remainder is set as an offset address. A physical group number (PGN) in correspondence to a logical group number (LGN) is determined as will be explained later, and the address conversion table 16 stores data of a physical group number (PGN) in correspondence to a logical group number (LGN).

[0026] By managing four sectors as one group, a storage capacity of a random access memory needed for the address conversion table can be decreased if compared with an address conversion table for management in the unit of a sector. For example, about 1.3 megabits of storage capacity are needed for managing all the sectors (81,920 sectors) in a semiconductor storage device of 40 megabytes. On the other hand, when one group consists of four sectors, only 280 kilobits or one random access memory chip of 512 kilobits is needed for managing all the groups (20,480 groups). Thus, a capacity of a random access memory for the address conversion table is reduced. Further, because a space needed for the random access memory is decreased, a larger capacity of a flash memory can be mounted in a semiconductor storage device.

[0027] In general, n sectors are managed as one group. If a number n of sectors in a group is increased, a storage capacity for an address conversion table can be decreased further. However, because data write is performed to a group, not used, the flash memory may not be used efficiently if a group consists of too many sectors. Therefore, a number of sectors in a group has to be determined by considering balance between the two points.

[0028] The flash memory 15 consists of a plurality of erase blocks. In a default setting, data of “1” is written to all the addresses, and a data is written by writing a data of “0” in required addresses.

[0029]FIG. 2 shows an erase block 20 in a flash memory 15. A block size is 64 kilobytes. An erase block 20 consists of a block management data block 21, a group management data block 22 and a data storage area 23. Information on the erase block 20 is written to the block management block 21. The information on the erase block 20 includes a count of erasing times and an inhibition flag for inhibiting a use of the block. Information for managing each group in the erase block 20 is provided for each group, and it is written to the group management data block 22. For example, if 60 groups exist in the erase block 20, 60 sets of group management information are stored. The content of management information for each group is shown in Table 1. TABLE 1 Group management information Items 1 Group erase enable flag F1 2 Group use status flag F2 3 Logical group number LGN 4 Error correction code data 5 Latest physical address ADD0 in sector 0 Latest physical address ADD1 in sector 1 Latest physical address ADD2 in sector 2 Latest physical address ADD3 in sector 3 6 Latest data flag F3

[0030] Group erase enable flag F1 is set as “1” when the group is not used or is in use. That is, it is set as “0” when no data exists in the group.

[0031] Group use status flag F2 on use status of the sectors in the group is set as “0” for a sector in use. If a group consists of four groups, the flag F2 is expressed as a 4-bit data. For example, if sectors 0, 1 and 2 are used, the flag F2 is expressed as “0001”.

[0032] The logical group number (LGN) represents a data of a logical group number for the group, and it is referred to when the address conversion table 16 is prepared when an electric power is turned on. If all the sectors are not used, a default value is given to the logical group number.

[0033] The error correction code data is an error correction code data used for improving reliability of the logical group number.

[0034] The four latest physical addresses ADD0-ADD3 represent whether data in physical addresses of four sectors 0, 1, 2 and 3 in the group are latest or not, and they are referred to when a data is read. For the latest data, a default value of “1111” is set, while if the data is written to an old group, the physical group number of the old group is written to the latest physical address.

[0035] The latest data flag F3 is set as “1” if at least one of the four sectors in the group stores the latest data. The sector storing the latest data means a sector for which the group use status flag F2 is set as “0”. When an electric power is turned on, the CPU 13 forms the address conversion table according to the data of the logical group number (LGN) of groups having the flags F1 and F3 both of “1”.

[0036] Next, data write on the semiconductor storage device is explained. There are two types of data write: new write and additional write. FIG. 3 shows a situation in an erase block 20 when new data are written to sectors 0, 1 and 2 of logical sector number LGN of α in the erase block. If the physical group number PGN in correspondence to the logical group number α is not stored in the address conversion table 16, it is decided that the data write is a new write. In this case, data are written to a group not used (having physical group number PGN of X). After the data are written to sectors 0, 1 and 2 of physical sector number PGN of X in the erase block 20 (as denoted with hatched lines), various flags on the group of logical group number LGN of X are updated in the group management data area 22. Further, as shown in FIG. 4, a physical group number PGN in correspondence to the logical group number LGN of α is written as “X” to the address conversion table 16.

[0037]FIG. 5 shows a different situation in the erase block 20 when data write has already been performed to sectors 0, 1 and 2 of a group of logical group number LGN of α and an additional data write is further performed to a sector 0 in another group of logical group number of α. A physical group number of X in correspondence to a logical group number α is determined by referring to the address conversion table. Because a data cannot be overwritten in a flash memory, a group not used is searched, and the additional data is written to sector 0 in he another group searched of a physical group number PGN of Y. The physical group number PGN of X and various flags the physical group number PGN of Y are updated in the group management data area 22. Further, as shown in FIG. 6, a physical group number PGN in correspondence to the logical group number LGN of α is written as “Y” in the address conversion table 16.

[0038] Table 2 shows flags in an old group (PGN=X) and in a new group (PGN=Y) when additional write is performed to sector 0 when data have already been written to sector 0, 1 and 2 in the group of physical group number PGN=X.

[0039] As shown in Table 2, the latest data flag F3 is set as “0” on the old group of PGN=X. On the other hand, for the new group of PGN=Y, a value of the lowest bit in the group use status flag F2 in correspondence to sector 0 is set as “0”, and physical group number X of the old group is written to ADD1 and ADD2 for sectors 1 and 2. When the host 10 requests to read sector 1 of the logical group number LGN of α, the data is read from sector 1 in the old group of physical sector number of X by referring to the physical group number of X stored in ADD1 for sector 1, and in the corresponding sector is read. When the host 10 requests to read sector 0 of logical group number LGN of α, the data in the corresponding sector is read. TABLE 2 Group management information New group Old group (PGN = Y) (PGN = X) Group erase enable flag F1   1   1 Group use status flag F2 0111 0001 Logical group number LGN α α Error correction code data ECC data ECC data Latest physical address 1111 1111 ADD0 in sector 0 Latest physical address PGN = X 1111 ADD1 in sector 1 Latest physical address PGN = X 1111 ADD2 in sector 2 Latest physical address 1111 1111 Add3 in sector 3 Latest data flag F3   1   0

[0040]FIGS. 7A and 7B show flowcharts of data write of the CPU 13. First, a logical sector number LSN of α is received from the host 10 (step S100), and the logical sector number is divided with n (=4 in this embodiment), and the quotient of the division is set as a logical group number LGN and the remainder is set as an offset address OA (step S101). Offset addresses of 0, 1, 2 and 3 are assigned to four sectors in a group successively from a sector of the smallest physical address. For example, when the logical sector numbers designated by the host 10 are 4, 5 and 6, the logical group number is set as “1” and the offset addresses OA are set and “0”, “1”, and “2”. Then, the address conversion table 16 is referred to (step S102), and it is confirmed if a physical group number PGN in correspondence to the logical group number LGN is registered in the address conversion table 16 (step S103). If the physical group number is decided not to be registered in the table (NO at step S103), the data write is decided to be a new data write, and the following processing is performed: First, the group use status flag F2 in the group management data area 22 in the erase block 20 is checked as to search a group wherein all the groups are not used (step S104) or a group having flag F2 of “1111”. Then, the data are written to sectors of the offset addresses OA in the searched group of a physical group number of X (step S105). Then, management data shown in Table 1 for the group to which the data are written are updated. That is, a corresponding bit data in the group use status flag F2 is written as “0” (step S106), the logical group number (LGN=X) obtained at step S101 is written as “0” (step S107), and the other flag data are updated (step S108). Finally, the address conversion table 16 is updated by writing the physical group number PGN of the group to which the data are written (step S109).

[0041] On the other hand, if the physical group number is decided to be registered in the address conversion table (YES at step S103), it is decided further if data has already been written to the relevant sector (step S117). If data is decided to have already been written to the sector (YES at step S117), additional data write is performed according to the following processing: First, the group use status flag F2 in the group management data area 22 in the erase block 20 is checked to search a group having flag F2 of “1111” wherein all the groups are not used (step S120). Then, the data are written to sectors of the offset addresses OA in the searched group not used of physical group number of Y (step S121). Then, management data shown in Table 1 for the old group of physical group number of X written in the address conversion table 16 and for the new group of physical group number Y to which the data are written are updated. That is, a corresponding bit data in the group use status flag F2 is written as “0” for the sector in the new group to which the data are written (step S122), the logical group number (LGN=X) obtained in step S101 is written ad “0” and the ECC data are written (step S123). The physical group number of X of the old group is written to the latest physical addresses ADDn of the sectors to which data have been written (step S124), the latest data flag F3 for the old group is set as “0” (step S125), and the address conversion table 16 is updated by writing the physical group number PGN of the latest group to which the data are written (step S126). If data is decided not to have already been written to the relevant sector (NO at step S117), the data is written to the sector (step S118), and the corresponding bit data in the group use status flag F2 is updated or written as “0” for the sector in the new group to which the data are written (step S119).

[0042] Next, data read processing by the CPU 13 is explained. When a data is read, an address data ADDn is checked on a sector of an offset address OA of a group of a physical group number PGN. If the address data is “1111”, a data stored in the sector is read. On the other hand, if an address data different from “1111” is written to the sector, an additional data write has been performed to the sector, and the data on the sector is written to the sector of the same offset address in an old group. Then, the address of the sector in the physical group number is checked until an address data of “1111” is found, and the data at the sector of the physical group number of the address data of “1111”. If additional data write is performed repeatedly, it takes a time to trace back to the group of the address data of “1111”. Then, a number of groups to be traced back is counted, and if the number exceeds three, the data of all the sectors are copied in a new group not used, and the erase enable flag F1 in each of the old groups is set as “0”, and the latest data flag F3 is set as “0”. This processing is called as abbreviated linkage. The abbreviated linkage is performed when a times of the group linkage exceeds a predetermined number, as explained above. Further, it may be performed when a time needed for tracing back the linkage exceeds a predetermined time because the linkage abbreviation is performed to shorten a time for data read within a certain level.

[0043] FIGS. 8A-8F show an example of group management data for illustrating group linkage when no abbreviated linkage is performed. FIGS. 8A, 8B, 8C, 8D and 8E show group management data for physical group number PGN of A, B, C, D and E. First, data write is requested to sectors 0, 1 and 2 in a group of a logical group number LGN of β, and the data are written to sectors 0, 1 and 2 of a corresponding physical group of address data of the group A. Next, additional data write is performed successively to sector 1, to sectors 1 and 2, to sectors 2 and 3 and to sector 3 as shown with the flag F2. The address data of “1111” means that the latest data is written to the group. As to sector 0, the data is written only on the group of PGN of A. Then, when the data of sector 0 is read, the latest group (F3=1) of PGN=E have to be traced back four times successively to the group of PGN=A, as shown with arrows, though the data of sectors 2 or 3 can be read readily from the group of PGN=E.

[0044] FIGS. 9A-9F show an example of group management data for illustrating abbreviated linkage. FIGS. 9A, 9B, 9C, 9D and 9E show group management data for physical group number PGN of A, B, C, D and E. Data write is performed similarly to the example shown in FIGS. 8A-8E, and the group management data are similar to those shown in FIGS. 8A, 8B, 8C, 8D and 8E. As explained above, when data are written to group of PGN=E, the count of groups to be traced back is four, and abbreviated linkage is performed. That is, as shown in FIG. 9F, a group not used for all the sectors of a group of a physical group number PGN of F is searched, and the latest data are copied in the group of PGN=F and the latest data flag F3 is set for the group of PGN=F. Further, the erase enable flag F1 is set on the groups of PGN of A to E.

[0045]FIG. 10 shows a flowchart of data read of the CPU 13. First, a logical sector number LSN is received from the host 10 (step S200), and the logical sector number is divided with n (=4 in this embodiment), and the quotient of the division is set as logical group number LGN and the remainder is set as offset address OA (step S201). Then, the address conversion table 16 is referred to (step S202), and a physical group number PGN in correspondence to the logical group number is confirmed by referring to the address conversion table 16 (step S203). Then, a count of groups to be traced back for abbreviated linkage is initialized as “1”, (step S204).

[0046] Next, if the address ADD obtained at step S202 is decided to be “1111” (YES at step S205), data at the address is read (step S206). Otherwise an address in correspondence to the physical group number having the same value as the address ADD is confirmed (step S207), the count C is incremented by one (step S208), and the flow returns to step S205.

[0047] After data is read at step S206 as mentioned above, it is checked if the count exceeds four or not (step 207). If the count is decided to exceed four (YES at step 207), abbreviated linkage is performed. First, a group not used is searched (step S210), and the latest data of all the sectors are copied to the new group (step S211). Then, each flag on the new group is updated (step S212), and group erase enable flag F1 is set as “0” on the old groups and the latest data flag F3 of the new group is set as “0” (step S213). Next, a physical group number PGN in the address conversion table 16 in correspondence to a physical group number PGN is updated to the number of the group to which the latest data are copied (step S214). Thus, group linkage is shortened. Because this abbreviated linkage takes a certain time, this processing is not performed if the count is less than four (NO at step S209).

[0048] Although the present invention has been fully described in connection with the preferred embodiments thereof with reference to the accompanying drawings, it is to be noted that various changes and modifications are apparent to those skilled in the art. Such changes and modifications are to be understood as included within the scope of the present invention as defined by the appended claims unless they depart therefrom. 

What is claimed is:
 1. A semiconductor storage device comprising: a flash memory consisting of a plurality of sectors; a means for converting a logical sector number to a logical group number and an offset address by dividing the logical sector number with a natural number n larger than one and by setting a quotient of division as the logical group number and a remainder of division as the offset address; a random access memory storing a conversion table for converting a logical group number to a physical group number; and a random access controller for determining a physical group number corresponding to the logical group number with reference to the conversion table in said random access memory and for accessing a sector in said flash memory in correspondence to a sum of the offset address and a product of the physical group number and the natural number n.
 2. The device according to claim 1, wherein the plurality of sectors in said flash memory is divided into a plurality of erase blocks.
 3. The device according to claim 1, further comprising a management means for storing information for managing each group of n sectors of the same physical group number, wherein when a data for a logical group number and an offset address is written to a sector in the group of the physical group number in correspondence to the logical group number, if any data has already been written to one of the sectors in the group, said access controller searches another group not used, writes the data in a sector in correspondence to the offset address in the another group, updates the physical group number in correspondence to the logical group number in the conversion table as a physical group number of the another group, and rewrites an address of the sector in said management means as the physical group number in correspondence to the logical group number before the conversion table is updated.
 4. The device according to claim 3, wherein data in said flash memory are erased in a unit of erase block consisting of a plurality of sectors, and said management means stores information for managing sectors in the unit of erase block.
 5. The device according to claim 3, wherein when a sector of a logical sector number is accessed for read, said access controller obtains a physical group number in correspondence to the logical group number by referring to the conversion table, and if another physical group number is stored in said management means in correspondence to the logical group number before the conversion table is updated, said access controller checks a status of the another physical group number, and said access controller checks statuses of physical group numbers with reference to said management means until a physical group number of a group which stores the data of a sector of the logical sector number is found.
 6. The device according to claim 5, wherein if a number of checks by said management means for finding a physical group number of a group which stores the data of a sector of the logical sector number exceeds a predetermined number, said controller searches a group not used, writes latest data to the group not used, and rewrites the physical group number in correspondence to the logical address number as a number of the group not used in the conversion table. 